package top.shmly.universal.web.error;

import top.shmly.universal.base.common.Result;
import top.shmly.universal.base.response.IResponseResult;
import top.shmly.universal.base.response.ResponseCode;
import top.shmly.universal.base.response.ResponseResult;

/**
 * @program: universal
 * @description: 通用异常
 * @author: Jibny
 * @date 2021-04-27 13:49:07
 */

public class UniversalException extends RuntimeException {
    private Result<String> Result;

    public UniversalException(String message) {
        super(message);
    }

    public UniversalException(IResponseResult<String> iResponseResult) {
        this.Result = iResponseResult.ok();
    }

    public UniversalException(ResponseCode responseCode) {
        IResponseResult<String> iResponseResult = new ResponseResult<String>();
        this.Result = iResponseResult.ok(responseCode);
    }


    public UniversalException(String msg, Throwable t) {
        super(msg, t);
    }

    public Result<String> getResult() {
        return this.Result;
    }

    public UniversalException setResponseWrap(Result<String> Result) {
        this.Result = Result;
        return this;
    }
}
